package com.zh.creature;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @description:
 * @author: zhangHang
 * @date: Created in 2020/5/24 23:00
 * @version: 1.0
 * @modified By:
 */
public class MonsterTigerSet {
    private ArrayList<MonsterTiger> monsterTigers = new ArrayList<>();//真正的集合
    private String id;
    private String description;
    public MonsterTigerSet(){

    }

    public MonsterTigerSet(ArrayList<MonsterTiger> monsterTigers) {
        this.monsterTigers = monsterTigers;
    }

    public MonsterTiger get(String id){//查找与获取
        MonsterTiger monsterTiger = null;
        for (MonsterTiger item:monsterTigers
             ) {
            if(id.equals(item.getId())){
                monsterTiger = item;
                break;
            }
        }
        return monsterTiger;
    }

    public void remove(String id){//移除
        Iterator<MonsterTiger> it = monsterTigers.iterator();
        while (it.hasNext()){
            MonsterTiger value = it.next();
            if(value.equals(get(id))){
                it.remove();
            }
        }
    }

    public ArrayList<MonsterTiger> getMonsterTigers() {
        return monsterTigers;
    }

    public void setMonsterTigers(ArrayList<MonsterTiger> monsterTigers) {
        this.monsterTigers = monsterTigers;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
